1. Technical Field
The present invention relates in general to an improved runtime machine such as a virtual machine or interpreter. Still more particularly, the present invention relates to an improved runtime machine for supporting method level caching.
2. Description of the Related Art
One consideration in application development is how to achieve performance requirements for an application across multiple hardware and software platforms. For many applications, caching data can significantly improve the performance of response times by saving computed results in a cache, associating the saved results with properties of the request, and obviating computations for subsequent similar requests by serving responses from the cache. In particular, enhanced performance may be achieved for object-oriented programming language applications by caching the outputs of methods, such as by caching a hash table generated when a method is run.
To improve the performance of applications across multiple platforms, many applications today are written to run on cross-platform runtime machines, such as virtual machines and interpreters. Examples of virtual machines include, but are not limited to Java Virtual Machine (JVM) (Java and JVM are registered trademarks of Sun Microsystems, Inc.) and Common Language Runtime (CLR). Examples of interpreters include, but are not limited to, PERL and PYTHON. Different versions of a runtime machine are written for various computer platforms, running various operating systems, where any application written for the runtime machine can be operated on any of the platforms, instead of a developer having to produce a separate version of the application for each computer and operating system.
Typically, for a runtime machine to run atop the operating system or hardware platform and execute an application, the runtime machine requests a portion of the cache heap from the operating system and manages the allocated portion of the cache heap. Currently, however, cache management by runtime machines does not include programming language support for caching data at the method level. Thus, to implement method level caching for applications written to run on a runtime machine, users are limited to writing custom code for a particular platform to manually store results of methods in the cache, such as by manually maintaining hash maps, or users are limited to writing applications to run through an additional layer of software with specialized libraries or APIs which control caching, where the additional layer of software runs atop the runtime machine.
Requiring a user to customize code for a platform for manual caching or to implement an additional software layer which supports method level caching, however, overlooks the goal of reusability of one version of an application across multiple platforms running on top a runtime machine at each platform. A user may write customized code to manually control method level caching based on the cache size, cache scheme and cache coherence for one platform, but for a different platform the code would have to be rewritten to provide enhanced performance on that platform. Further, a user may write customized code with caching commands for method level caching supported by a specialized software layer, but then for the application to run on a particular platform, that additional software layer is required in addition to the runtime machine.
Therefore, there is a need for a method, system, and program for supporting fine-grained, method level caching through a runtime machine, in the portion of the cache heap allocated to the runtime machine. In addition, there is a need for an interface through which a user may select, during runtime, whether to direct the runtime machine to cache the output of a particular method.